function VARtestplot_2New_CCP(IRFmed1,IRFmed2,pick,labels,filename,ordend2,INF1,SUP1,INF2,SUP2,FontSize)
% =======================================================================
% Plot the difference between two GIRFs
%
% =======================================================================
% VARirplot_2(IRF1,IRF2,pick,labels,filename,INF1,SUP1,INF2,SUP2,FontSize)
% -----------------------------------------------------------------------
% INPUT
%   IRFmed1(:,:,:) : matrix with periods, variable, shock
%   IRFmed2(:,:,:) : matrix with periods, variable, shock
%
% OPTIONAL INPUT
%   pick     : a vector containing the shocks to be plotted [default 0 = all]
%   labels   : name of the variables, ordered as in the Cholesky
%   filename : name for file saving
%   INF1      : lower error band
%   SUP1      : upper error band
%   INF2      : lower error band
%   SUP2      : upper error band
%   Fontsize
% =======================================================================
% slightly modified (by Giovanni Pellegrino) on the basis of the function
% VARirplot by Ambrogio Cesa Bianchi, May 2012 (ambrogio.cesabianchi@gmail.com)


%% Check optional inputs & Define some parameters
%================================================
if ~exist('filename','var') 
    filename = 'shock_';
end

if ~exist('FontSize','var') 
    FontSize = 16;
end

% Initialize IRF matrix
[nsteps, nvars, nshocks] = size(IRFmed1);

% If one shock is chosen, set the right value for nshocks
if ~exist('pick','var') 
    pick = 1;
else
    if pick<0 || pick>nvars
        error('The selected shock is non valid')
    else
        if pick==0
            pick=1;
        else
            nshocks = pick;
        end
    end
end

% Define the rows and columns for the subplots
row = round(sqrt(nvars));
col =  ceil(sqrt(nvars));

% Define a timeline
steps = 1:1:nsteps;
x_axis = zeros(1,nsteps);


%% Plot
%=========
% FigSize(24,8)
             
    for ii=1:nvars
%         figure(jj)
        subplot(col,row,ii);
          if exist('INF1','var') && exist('SUP1','var')
          
             shadedplot(steps,INF2(:,ii)',SUP2(:,ii)',[0.9 0.9 0.9],[0.9 0.9 0.9] );
             hold on
             plot(steps,INF2(:,ii),'LineStyle',':','Color',rgb('black'),'LineWidth',1);
             hold on
             plot(steps,SUP2(:,ii),'LineStyle',':','Color',rgb('black'),'LineWidth',1);           
             
             hold on
%             plot(steps,INF1(:,ii),'LineStyle','-','Color',rgb('light blue'),'LineWidth',1);
%             hold on
%             plot(steps,SUP1(:,ii),'LineStyle','-','Color',rgb('light blue'),'LineWidth',1);
            shadedplot(steps,INF1(:,ii)',SUP1(:,ii)',[0.7 0.7 0.7],[0.7 0.7 0.7] );
            hold on 
          end       
        
        plot(steps,IRFmed1(:,ii),'LineStyle','-','Color',rgb('black'),'LineWidth',1.5);
        hold on
        plot(steps,IRFmed2(:,ii),'LineStyle','-','Color',rgb('black'),'LineWidth',1.5);
          hold on
          if exist('INF2','var') && exist('SUP2','var')
              plot(steps,INF2(:,ii),'LineStyle','-','Color',rgb('dark blue'),'LineWidth',1);
              hold on
              plot(steps,SUP2(:,ii),'LineStyle','-','Color',rgb('dark blue'),'LineWidth',1);
              hold on
          end
        plot(x_axis,'k','LineWidth',0.5)

        xlim([1 nsteps]);
        if exist('labels','var') 
            title(labels(ii),'FontSize',FontSize); 
        end
%         xlabel('Place your label here');
%         ylabel('Place your label here');
%         FigFont(FontSize);
       set(gca,'XTickLabelMode', 'manual','XTickLabel',{'5','10','15','20'},'XTick',[5 10 15 20])

    end
    if exist('labels','var')
      end

%     % Save
%     set(gcf, 'Color', 'w');
%     FigName = [filename num2str(jj)];
%     export_fig(FigName,'-pdf','-png','-painters')
%     clf('reset');


% close all
